<template>
  <!-- '我的课程-考试列表-试题审批列表 -->
  <div id="t-item-bank" class="jx-content">
    <div class="search-box fl">
      <el-form :inline="true" ref="searchForm" label-width="80px">
        <el-form-item label="学生信息">
          <el-input v-model="reqData.userInfo" placeholder="请输入学号或姓名"></el-input>
        </el-form-item>
        <el-form-item>
          <div @click="getList" class="button-style">搜 索</div>
        </el-form-item>
      </el-form>
    </div>
    <div class="btn-group fr">
      <el-form :inline="true">
        <el-form-item>
          <div @click="refreshList" class="button-style">刷新</div>
        </el-form-item>
      </el-form>
    </div>
    <div class="clear"></div>
    <div v-if="resData">
      <el-table :data="resData.content" style="width: 100%">
        <el-table-column type="index" label="序号" width="50"></el-table-column>
        <el-table-column prop="studentName" label="学生姓名"></el-table-column>
        <el-table-column prop="studentNumber" label="学号"></el-table-column>
        <el-table-column prop="className" label="班级"></el-table-column>
        <el-table-column prop="grade" label="年级"></el-table-column>
        <el-table-column prop="score" label="得分"></el-table-column>
        <el-table-column prop="statusMessage" label="状态"></el-table-column>
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <div class="table-button">
              <router-link target="_blank" @click.native="markingPage(scope.row)" :to="{path:'/TeacherMarking',query:{ paperId:$route.query.paperId }}">
                <span v-if="scope.row.paperStatus === 3">审批</span>
                <span v-if="scope.row.paperStatus === 4">修改</span>
              </router-link>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="resData.pageNum" :page-size="resData.pageSize" :total="resData.total" layout="total, prev, pager, next, jumper"></el-pagination>

  </div>
</template>
<script>
import axios from "axios";
import $ from "jquery";
export default {
  data() {
    return {
      resData: [],
      reqData: {
        userInfo: "",
        pageNum: 1,
        pageSize: 10
      },
      currentPage: 10
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.getList();
    },
    //审批 存储answerSheetId
    markingPage(row) {
      //answerSheetId:scope.row.id
      let localStorage = window.localStorage;
      localStorage.setItem("answerSheetId", row.id);
    },
    //获取table列表
    getList() {
      let that = this;
      //接收试卷id
      let paperId = that.$route.query.paperId;
      axios
        .get(
          "/tes/course/" +
            this.$localstorage.getLocalStorage("setCourseId") +
            "/course-test/paper/" +
            paperId +
            "/student",
          { params: that.reqData }
        )
        .then(function(res) {
          console.log("成功");
          console.log(res);
          if (res.status === 200) {
            if (res.data.code === 200) {
              that.resData = res.data.data;
            } else {
              that.$message({
                message: res.data.message,
                type: "error"
              });
            }
          }
        })
        .catch(function(err) {
          if (err.response) {
            console.log(err.response);
          }
        });
    },
    //刷新
    refreshList() {
      this.getList();
      this.$message.success("刷新成功");
    },
    handleSizeChange(a) {},
    handleCurrentChange(a) {
      this.reqData.pageNum = a;
      this.getList();
    }
  }
};
</script>
<style lang="scss">
@import "../../../styles/layout/color_variables";
#t-item-bank {
  width: 1200px;
  margin: 30px auto;
  .dialog-questions {
    .dialog-content {
      padding: 20px 64px 0;
      .question-title {
        font-weight: bold;
        font-size: 16px;
        margin-bottom: 20px;
      }
      .question-chose {
        font-size: 14px;
        line-height: 24px;
        padding: 6px 0;
        display: flex;
        .question-flex {
          flex: 1;
        }
      }
      .question-answer {
        font-size: 16px;
        .chose {
          font-size: 18px;
          color: #385899;
          vertical-align: -2px;
        }
        margin-top: 20px;
      }
    }
    .el-dialog__footer {
      text-align: center;
    }
  }
  .dialog-import-questions {
    .dialog-content {
      text-align: center;
      padding: 60px 0 40px;
    }
    .el-dialog__footer {
      text-align: center;
    }
  }
  .progress-box {
    display: flex;
    justify-content: center;
    align-items: center;
    .progress-line {
      flex: 1;
      margin-right: 10px;
    }
  }
}
</style>
